import Vue from 'vue'
import Vuex from 'vuex'
import lang from './modules/lang'
import user from './modules/user'
import custom from './modules/custom'

const state = {
  isAnnouncementShow: true,
  isAnnLoaded: false,
  annList: []
}

const getters = {
  isAnnouncementShow: () => state.isAnnouncementShow,
  isAnnLoaded: () => state.isAnnLoaded,
  annList: () => state.annList
}

const mutations = {
  toggleAnnouncement (state, val) {
    state.isAnnouncementShow = val
  },
  toggleAnnState (state, val) {
    state.isAnnLoaded = val
  },
  createAnnList (state, list) {
    state.annList = list
  }
}

Vue.use(Vuex)

export default new Vuex.Store({
  modules: {
    lang,
    user,
    custom
  },
  state,
  getters,
  mutations
})
